/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ep.m009.ui.controllers;

import com.vaadin.data.util.BeanItemContainer;
import ep.m009.bl.BL009Controller;
import ep.persistence.entities.T005Patient;
import ep.persistence.entities.T006Prescription;
import java.util.Collection;

/**
 *
 * @author Spyros
 */
public class M009Controller {

    private T005Patient patient;
    private BL009Controller bL009Controller;

    public M009Controller(Object patientObject) {
        this.patient = (T005Patient) patientObject;
        bL009Controller = new BL009Controller();
    }

    public BeanItemContainer<T006Prescription> getPrescDataSource(){
        BeanItemContainer<T006Prescription> beanItemContainer =
                new BeanItemContainer<T006Prescription>(
                T006Prescription.class,
                bL009Controller.getUnprescripedDosageByPatient(patient.getId()));
        return beanItemContainer;
    }

    public T005Patient getPatient() {
        return patient;
    }

    public Integer getPresctriptionId(Object prescObject){
        T006Prescription prescription = (T006Prescription) prescObject;
        return prescription.getId();
    }
    
}
